package com.zhongmeng.rxjava2test.utils

import android.content.Context
import android.view.View
import android.widget.ImageView

import com.bigkoo.convenientbanner.holder.Holder
import com.bumptech.glide.Glide
import com.zhongmeng.rxjava2test.R

/**
 * Created by Sai on 15/8/4.
 * 网络图片加载例子
 */
class NetworkImageHolderView : Holder<String> {
    private var imageView: ImageView? = null
    override fun createView(context: Context): View {
        //你可以通过layout文件来创建，也可以像我一样用代码创建，不一定是Image，任何控件都可以进行翻页
        imageView = ImageView(context)
        imageView!!.scaleType = ImageView.ScaleType.FIT_XY
        return imageView as ImageView
    }

    override fun UpdateUI(context: Context, position: Int, data: String) {
        imageView!!.setImageResource(R.mipmap.ic_launcher)
        //ImageLoader.getInstance().displayImage(data,imageView);
        Glide.with(context).load(data).into(imageView!!)
    }
}
